//
//  WKOneViewCell.m
//  WKDemo
//
//  Created by wangzhaohui-Mac on 14-8-4.
//  Copyright (c) 2014年 com.app. All rights reserved.

#import "WKOneViewCell.h"
#import "WKResult.h"
#import "WKStatusFrame.h"
#import "MJPhotoBrowser.h"
#import "MJPhoto.h"
#import "WKDetailView.h"

@interface WKOneViewCell ()

/**cell内容控件*/
@property (nonatomic, weak) WKDetailView *detailView;
@end

@implementation WKOneViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"cell";
    WKOneViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[WKOneViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
    {
        self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
        if (self) {
            //清除cell的背景颜色
            self.backgroundColor = [UIColor clearColor];
            //取消显示选中时的阴影
            self.selectionStyle = UITableViewCellSelectionStyleNone;
            
            //1,添加cell内容控件
            WKDetailView *detailView = [[WKDetailView alloc] init];
            [self addSubview:detailView];
            self.detailView = detailView;
        }
        return self;
}

- (void)setStatusFrame:(WKStatusFrame *)statusFrame
{
    _statusFrame = statusFrame;
    
    self.detailView.statusFrame = statusFrame;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat x = 0;
    CGFloat y = 5;
    CGFloat w = self.width;
    CGFloat h = self.height - y;
    self.detailView.frame = CGRectMake(x, y, w, h);
}
@end
